<?
if (!defined('IN_RJ')) die("Error 404");
if($cmd[1]=="song" && is_numeric($cmd[2])){
$m_id=$cmd[2];
$m_multi_chk=$func->get_data("song",$m_id,"m_multimedia");
$chk=$DB->num_rows($DB->query("select multi_id from {$conf['prefix']}multimedia where multi_type=1 and multi_id={$m_multi_chk}"));
if($chk || $m_multi_chk=='0'){
$DB->query("update ".$conf['prefix']."media set m_viewed=m_viewed+1,m_viewed_month=m_viewed_month+1 where m_id={$m_id}");
$query="select * from ".$conf['prefix']."media where m_id={$m_id}";
$rq = $DB->query($query);
    if ($song=$DB->fetch_row($rq)){
		 $ro= $tpl->get_tpl('play_song');
		 $cat_name =$func->get_data("cat",$song['m_cat']);
		  $singer_name=$func->get_data("singer",$song['m_singer']);
		 $poster=$func->get_data("user",$song['m_poster']);
		 $al_name=$func->get_data("multimedia",$song['m_multimedia']);
			$ju= $tpl->get_tpl('song_info');
			$ju = $tpl->assign_vars($ju,
				array(
					'singer.IMG'	=>	$func->get_img("singer",$song['m_singer']),
					'singer.NAME'	=> $singer_name,
					'singer.URL'	=> $func->change_link("singer",$song['m_singer'],$func->title_2_ascii($singer_name,true)),
					'song.TITLE'	=>	$song['m_title'],
					'song.CAT_NAME'	=> $cat_name,
					'song.CAT_URL'	=> $func->change_link("cat",$song['m_cat'],$func->title_2_ascii($cat_name,true)),
					'song.POSTER'	=> $poster,
					'song.POSTER_URL'	=> $func->change_link("user",$song['m_poster'],$func->title_2_ascii($poster,true)),
					'song.VIEWED'	=> $song['m_viewed'],
					'song.DOWNLOADED'	=> $song['m_downloaded'],
					'song.DOWNLOAD' => "<a href=\"#\" onclick=\"get_download('','song','{$m_id}','".$func->encode_down($m_id)."');return false;\" >".$lang['download']."</a><span id=\"field_download\"></span>",
					'song.AL_NAME'  => $al_name,
					'song.AL_URL'	=> $func->change_link("album",$song['m_multimedia'],$func->title_2_ascii($al_name,true)),
					'song.RATE_IMG' => $func->check_rate($song["m_rating"],$song["m_rating_total"]),
					'song.ID'		=> 	$m_id,
					'song.ADD_PL'	=> $logged_in?"select_playlist({$m_id});return false;":"guest_playlist({$m_id});return false;",
					
				)
			);	
			$player=$func->get_player($song['m_id']);
			$ro = $tpl->assign_vars($ro,
				array(
					'song.INFO' 	=> $ju,
					'song.PLAYER'	=> $player,
					'song.ID'		=> $m_id,
					'song.BLOG'		=> $player,
					'song.LYRIC'	=> $func->unhtmlchars($song['m_lyric']),
					'song.ALBUM_ID'	=> $song['m_multimedia'],
				)
			);
			if(!$song['m_lyric'])
			$ro=$tpl->unset_block($ro,array('lyric'));
	
	}
	else $ro=box_announcement($lang['no_data']);
	
}else $ro=box_announcement($lang['no_data']);
	$main_content=$ro;
	$title_web_bar=$song['m_title'];
	$title_ascii_web_bar=$song['m_title_ascii'];

}
?>